<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var arr = [['a', 'b', 'c'], ['d', 'e', 'f'], ['g', 'h', 'i'], ['j', 'k', 'l']];
    var res = [];
    for (var i = 0; i < arr[0].length; ++i) {  // i表示arr数组中的纵向元素索引
      res[i] = [];
      for(var j = 0; j < arr.length; ++j){	   // j表示arr数组中的横向元素索引
        res[i][j] = arr[j][i];                 // 为二维数组赋值
      }
    }
    console.log(arr);
    console.log(res);
    </script>
</body>
</html>